class Rank < ApplicationRecord
  scope :ordered, -> { order(serial_id: :asc, id: :asc) }
  
  belongs_to :playlist
  has_many :songs, through: :playlist
  
  class << self
    def top3
      ordered.map { |x| x.songs.take(3) }
    end
  end
end
